home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bailer.swf / scripts / DefineSprite_414 / frame_1 / DoAction.as
Text File  |  2013-04-24  |  2KB  |  78 lines

  1. function xStart()
  2. {
  3.    specialDrop = -1;
  4.    switch(_parent.levelNo)
  5.    {
  6.       case 1:
  7.          DROP_WAIT = 50;
  8.          DROP_SKIP = 1;
  9.          DROP_RND = 10;
  10.          DROP_LIST = [20,45,35,0,0,0];
  11.          missCnt = 0;
  12.          break;
  13.       case 2:
  14.          DROP_WAIT = 30;
  15.          DROP_SKIP = 2;
  16.          DROP_RND = 20;
  17.          DROP_LIST = [20,35,30,10,0,5];
  18.          break;
  19.       case 3:
  20.          DROP_WAIT = 20;
  21.          DROP_SKIP = 1;
  22.          DROP_RND = 10;
  23.          DROP_LIST = [10,30,20,10,0,30];
  24.          if(missCnt <= 5)
  25.          {
  26.             specialDrop = 600 + Math.floor(Math.random() * 30 * 30);
  27.          }
  28.    }
  29.    trace(missCnt);
  30.    cnt = DROP_WAIT;
  31.    this.onEnterFrame = function()
  32.    {
  33.       if(_parent.gameState != 1)
  34.       {
  35.          return undefined;
  36.       }
  37.       if(specialDrop > 0)
  38.       {
  39.          specialDrop--;
  40.       }
  41.       if(--cnt <= 0)
  42.       {
  43.          cnt = DROP_SKIP;
  44.          if(specialDrop == 0)
  45.          {
  46.             specialDrop = -1;
  47.             this.xDropItem(5);
  48.          }
  49.          else if(Math.random() * 100 < DROP_RND)
  50.          {
  51.             cnt = DROP_WAIT;
  52.             var _loc5_ = Math.random() * 100;
  53.             var _loc4_ = 0;
  54.             var _loc3_ = 0;
  55.             while(_loc3_ < DROP_LIST.length)
  56.             {
  57.                _loc4_ += DROP_LIST[_loc3_];
  58.                if(_loc5_ < _loc4_)
  59.                {
  60.                   break;
  61.                }
  62.                _loc3_ = _loc3_ + 1;
  63.             }
  64.             this.xDropItem(_loc3_ + 1);
  65.          }
  66.       }
  67.    };
  68. }
  69. function xDropItem(no)
  70. {
  71.    var _loc3_ = Math.floor(Math.random() * Stage.width);
  72.    var _loc2_ = Math.floor(Math.random() * 50 + 50);
  73.    dp++;
  74.    iniObj = {_x:_loc3_,_y:_loc2_,no:no};
  75.    this.attachMovie("symItem","item" + dp,dp,iniObj);
  76. }
  77. dp = 0;
  78.